//package com.linb.pan.server.common.listener.log;
//
//import com.linb.pan.core.utils.IdUtil;
//import com.linb.pan.server.common.event.log.ErrorLogEvent;
//import com.linb.pan.server.modules.log.entity.BPanErrorLog;
//import com.linb.pan.server.modules.log.service.IBPanErrorLogService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.event.EventListener;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Component;
//
//import java.util.Date;
//
//@Component
//public class ErrorLogEventListener {
//
//    @Autowired
//    private IBPanErrorLogService errorLogService;
//
//    /**
//     * 监听文件删除失败事件，保存到日志中
//     */
//    @EventListener(ErrorLogEvent.class)
//    @Async(value = "eventListenerTaskExecutor")
//    public void saveErrorLog(ErrorLogEvent event) {
//        BPanErrorLog bPanErrorLog = new BPanErrorLog();
//        bPanErrorLog.setId(IdUtil.get());
//        bPanErrorLog.setLogContent(event.getErrorMsg());
//        bPanErrorLog.setLogStatus(0);
//        bPanErrorLog.setCreateUser(event.getUserId());
//        bPanErrorLog.setCreateTime(new Date());
//        bPanErrorLog.setUpdateUser(event.getUserId());
//        bPanErrorLog.setUpdateTime(new Date());
//        errorLogService.save(bPanErrorLog);
//    }
//
//}
